home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tcl8.0 / win / cat.c next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  633 b   |  38 lines  |  [TEXT/CWIE]

  1. /*
  2.  * cat.c --
  3.  *
  4.  *    Program used when testing tclWinPipe.c
  5.  *
  6.  * Copyright (c) 1996 by Sun Microsystems, Inc.
  7.  *
  8.  * See the file "license.terms" for information on usage and redistribution
  9.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  10.  *
  11.  * SCCS: @(#) cat.c 1.3 96/09/18 15:15:32
  12.  */
  13.  
  14. #include <stdio.h>
  15. #include <io.h>
  16. #include <string.h>
  17.  
  18. int
  19. main()
  20. {   
  21.     char buf[1024];
  22.     int n;
  23.     char *err;
  24.  
  25.     while (1) {
  26.     n = read(0, buf, sizeof(buf));
  27.     if (n <= 0) {
  28.         break;
  29.     }
  30.         write(1, buf, n);
  31.     }
  32.     err = (sizeof(int) == 2) ? "stderr16" : "stderr32";
  33.     write(2, err, strlen(err));
  34.  
  35.     return 0;
  36. }
  37.     
  38.